
/**
 *  \file hci_defines.h
 *
 *  This header file contains the definitions for various HCI Command
 *  Opcodes and HCI Events.
 */

/*
 *  Copyright (C) 2013. Mindtree Ltd.
 *  All rights reserved.
 */

#ifndef _H_HCI_DEFINES_
#define _H_HCI_DEFINES_


/* ------------------------------------------- Type Definitions */

/* ======== HCI Command Opcode Lengths  ========================= */

/* HCI Command Header Length */
#define HCI_HDR_LEN                                      3

/* Maximum Length of HCI Command - not including the HCI Header Length */
#define HCI_COMMAND_MAX_LENGTH                           255

#define HCI_INQUIRY_LENGTH                               (5 + HCI_HDR_LEN)
#define HCI_INQUIRY_CANCEL_LENGTH                        (0 + HCI_HDR_LEN)
#define HCI_PERIODIC_INQUIRY_MODE_LENGTH                 (9 + HCI_HDR_LEN)
#define HCI_EXIT_PERIODIC_INQUIRY_MODE_LENGTH            (0 + HCI_HDR_LEN)
#define HCI_CREATE_CONNECTION_LENGTH                     (13 + HCI_HDR_LEN)
#define HCI_DISCONNECT_LENGTH                            (3 + HCI_HDR_LEN)
#define HCI_ADD_SCO_CONNECTION_LENGTH                    (4 + HCI_HDR_LEN)
#define HCI_ACCEPT_CONNECTION_REQUEST_LENGTH             (7 + HCI_HDR_LEN)
#define HCI_REJECT_CONNECTION_REQUEST_LENGTH             (7 + HCI_HDR_LEN)
#define HCI_LINK_KEY_REQUEST_REPLY_LENGTH                (22 + HCI_HDR_LEN)
#define HCI_LINK_KEY_REQUEST_NEGATIVE_REPLY_LENGTH       (6 + HCI_HDR_LEN)
#define HCI_PIN_CODE_REQUEST_REPLY_LENGTH                (23 + HCI_HDR_LEN)
#define HCI_PIN_CODE_REQUEST_NEGATIVE_REPLY_LENGTH       (6 + HCI_HDR_LEN)
#define HCI_CHANGE_CONNECTION_PACKET_TYPE_LENGTH         (4 + HCI_HDR_LEN)
#define HCI_AUTHENTICATION_REQUESTED_LENGTH              (2 + HCI_HDR_LEN)
#define HCI_SET_CONNECTION_ENCRYPTION_LENGTH             (3 + HCI_HDR_LEN)
#define HCI_CHANGE_CONNECTION_LINK_KEY_LENGTH            (2 + HCI_HDR_LEN)
#define HCI_MASTER_LINK_KEY_LENGTH                       (1 + HCI_HDR_LEN)
#define HCI_REMOTE_NAME_REQUEST_LENGTH                   (10 + HCI_HDR_LEN)
#define HCI_READ_REMOTE_SUPPORTED_FEATURES_LENGTH        (2 + HCI_HDR_LEN)
#define HCI_READ_REMOTE_VERSION_INFORMATION_LENGTH       (2 + HCI_HDR_LEN)
#define HCI_READ_CLOCK_OFFSET_LENGTH                     (2 + HCI_HDR_LEN)

#ifdef BT_HCI_1_2
#define HCI_CREATE_CONNECTION_CANCEL_LENGTH              (6 + HCI_HDR_LEN)
#define HCI_REMOTE_NAME_REQUEST_CANCEL_LENGTH            (6 + HCI_HDR_LEN)
#define HCI_READ_REMOTE_EXTENDED_FEATURES_LENGTH         (3 + HCI_HDR_LEN)
#define HCI_SETUP_SYNCHRONOUS_CONNECTION_LENGTH          (17 + HCI_HDR_LEN)
#define HCI_ACCEPT_SYNCHRONOUS_CONNECTION_REQUEST_LENGTH (21 + HCI_HDR_LEN)
#define HCI_REJECT_SYNCHRONOUS_CONNECTION_REQUEST_LENGTH (7 + HCI_HDR_LEN)
#endif /* BT_HCI_1_2 */

#ifdef BT_SSP
#define HCI_IO_CAP_REQUEST_REPLY_LENGTH                  (9 + HCI_HDR_LEN)
#define HCI_IO_CAP_REQUEST_NEGATIVE_REPLY_LENGTH         (7 + HCI_HDR_LEN)
#endif /* BT_SSP */

#ifdef BT_SSP_UC
#define HCI_USER_CONF_REQUEST_REPLY_LENGTH               (6 + HCI_HDR_LEN)
#define HCI_USER_CONF_REQUEST_NEGATIVE_REPLY_LENGTH      (6 + HCI_HDR_LEN)
#endif /* BT_SSP_UC */

#ifdef BT_SSP_PE
#define HCI_USER_PASSKEY_REQUEST_REPLY_LENGTH            (10 + HCI_HDR_LEN)
#define HCI_USER_PASSKEY_REQUEST_NEGATIVE_REPLY_LENGTH   (6 + HCI_HDR_LEN)
#endif /* BT_SSP_PE */

#ifdef BT_SSP_OOB
#define HCI_REMOTE_OOB_DATA_REQUEST_REPLY_LENGTH         (38 + HCI_HDR_LEN)
#define HCI_REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY_LENGTH \
                                                         (6 + HCI_HDR_LEN)
#endif /* BT_SSP_OOB */


#define HCI_HOLD_MODE_LENGTH                             (6 + HCI_HDR_LEN)
#define HCI_SNIFF_MODE_LENGTH                            (10 + HCI_HDR_LEN)
#define HCI_EXIT_SNIFF_MODE_LENGTH                       (2 + HCI_HDR_LEN)
#define HCI_PARK_MODE_LENGTH                             (6 + HCI_HDR_LEN)
#define HCI_EXIT_PARK_MODE_LENGTH                        (2 + HCI_HDR_LEN)
#define HCI_QOS_SETUP_LENGTH                             (20 + HCI_HDR_LEN)
#define HCI_ROLE_DISCOVERY_LENGTH                        (2 + HCI_HDR_LEN)
#define HCI_SWITCH_ROLE_LENGTH                           (7 + HCI_HDR_LEN)
#define HCI_READ_LINK_POLICY_SETTINGS_LENGTH             (2 + HCI_HDR_LEN)
#define HCI_WRITE_LINK_POLICY_SETTINGS_LENGTH            (4 + HCI_HDR_LEN)

#ifdef BT_HCI_1_2
#define HCI_READ_DEFAULT_LINK_POLICY_SETTINGS_LENGTH     (0 + HCI_HDR_LEN)
#define HCI_WRITE_DEFAULT_LINK_POLICY_SETTINGS_LENGTH    (2 + HCI_HDR_LEN)
#define HCI_FLOW_SPECIFICATION_LENGTH                    (21 + HCI_HDR_LEN)
#endif /* BT_HCI_1_2 */

#ifdef BT_SSR
#define HCI_SNIFF_SUBRATING_LENGTH                       (8 + HCI_HDR_LEN)
#endif /* BT_SSR */


#define HCI_SET_EVENT_MASK_LENGTH                        (8 + HCI_HDR_LEN)
#define HCI_RESET_LENGTH                                 (0 + HCI_HDR_LEN)

/* Maximum Size for Set Event Filter = 12 */
#define HCI_SET_EVENT_FILTER_LENGTH                      (12 + HCI_HDR_LEN)
#define HCI_FLUSH_LENGTH                                 (2 + HCI_HDR_LEN)
#define HCI_READ_PIN_TYPE_LENGTH                         (0 + HCI_HDR_LEN)
#define HCI_WRITE_PIN_TYPE_LENGTH                        (1 + HCI_HDR_LEN)
#define HCI_CREATE_NEW_UNIT_KEY_LENGTH                   (0 + HCI_HDR_LEN)
#define HCI_READ_STORED_LINK_KEY_LENGTH                  (7 + HCI_HDR_LEN)

/* Variable length, Max = 256 */
#define HCI_WRITE_STORED_LINK_KEY_LENGTH                 (256 + HCI_HDR_LEN)

#define HCI_DELETE_STORED_LINK_KEY_LENGTH                (7 + HCI_HDR_LEN)

/* Name length = 248 */
#define HCI_CHANGE_LOCAL_NAME_LENGTH                     (248 + HCI_HDR_LEN)

#define HCI_READ_LOCAL_NAME_LENGTH                       (0 + HCI_HDR_LEN)
#define HCI_READ_CONNECTION_ACCEPT_TIMEOUT_LENGTH        (0 + HCI_HDR_LEN)
#define HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT_LENGTH       (2 + HCI_HDR_LEN)
#define HCI_READ_PAGE_TIMEOUT_LENGTH                     (0 + HCI_HDR_LEN)
#define HCI_WRITE_PAGE_TIMEOUT_LENGTH                    (2 + HCI_HDR_LEN)
#define HCI_READ_SCAN_ENABLE_LENGTH                      (0 + HCI_HDR_LEN)
#define HCI_WRITE_SCAN_ENABLE_LENGTH                     (1 + HCI_HDR_LEN)
#define HCI_READ_PAGE_SCAN_ACTIVITY_LENGTH               (0 + HCI_HDR_LEN)
#define HCI_WRITE_PAGE_SCAN_ACTIVITY_LENGTH              (4 + HCI_HDR_LEN)
#define HCI_READ_INQUIRY_SCAN_ACTIVITY_LENGTH            (0 + HCI_HDR_LEN)
#define HCI_WRITE_INQUIRY_SCAN_ACTIVITY_LENGTH           (4 + HCI_HDR_LEN)
#define HCI_READ_AUTHENTICATION_ENABLE_LENGTH            (0 + HCI_HDR_LEN)
#define HCI_WRITE_AUTHENTICATION_ENABLE_LENGTH           (1 + HCI_HDR_LEN)
#define HCI_READ_ENCRYPTION_MODE_LENGTH                  (0 + HCI_HDR_LEN)
#define HCI_WRITE_ENCRYPTION_MODE_LENGTH                 (1 + HCI_HDR_LEN)
#define HCI_READ_CLASS_OF_DEVICE_LENGTH                  (0 + HCI_HDR_LEN)
#define HCI_WRITE_CLASS_OF_DEVICE_LENGTH                 (3 + HCI_HDR_LEN)
#define HCI_READ_VOICE_SETTING_LENGTH                    (0 + HCI_HDR_LEN)
#define HCI_WRITE_VOICE_SETTING_LENGTH                   (2 + HCI_HDR_LEN)
#define HCI_READ_AUTOMATIC_FLUSH_TIMEOUT_LENGTH          (2 + HCI_HDR_LEN)
#define HCI_WRITE_AUTOMATIC_FLUSH_TIMEOUT_LENGTH         (4 + HCI_HDR_LEN)
#define HCI_READ_NUM_BROADCAST_RETRANSMISSIONS_LENGTH    (0 + HCI_HDR_LEN)
#define HCI_WRITE_NUM_BROADCAST_RETRANSMISSIONS_LENGTH   (1 + HCI_HDR_LEN)
#define HCI_READ_HOLD_MODE_ACTIVITY_LENGTH               (0 + HCI_HDR_LEN)
#define HCI_WRITE_HOLD_MODE_ACTIVITY_LENGTH              (1 + HCI_HDR_LEN)
#define HCI_READ_TRANSMIT_POWER_LEVEL_LENGTH             (3 + HCI_HDR_LEN)
#define HCI_READ_SCO_FLOW_CONTROL_ENABLE_LENGTH          (0 + HCI_HDR_LEN)
#define HCI_WRITE_SCO_FLOW_CONTROL_ENABLE_LENGTH         (1 + HCI_HDR_LEN)
#define HCI_SET_HOST_CONTROLLER_TO_HOST_FLOW_CONTROL_LENGTH    \
                                                         (1 + HCI_HDR_LEN)
#define HCI_HOST_BUFFER_SIZE_LENGTH                      (7 + HCI_HDR_LEN)

/* Variable length, Max = 256 */
#define HCI_HOST_NUMBER_OF_COMPLETED_PACKETS_LENGTH      (256 + HCI_HDR_LEN)

#define HCI_READ_LINK_SUPERVISION_TIMEOUT_LENGTH         (2 + HCI_HDR_LEN)
#define HCI_WRITE_LINK_SUPERVISION_TIMEOUT_LENGTH        (4 + HCI_HDR_LEN)
#define HCI_READ_NUMBER_OF_SUPPORTED_IAC_LENGTH          (0 + HCI_HDR_LEN)
#define HCI_READ_CURRENT_IAC_LAP_LENGTH                  (0 + HCI_HDR_LEN)

/* Variable length, Max = 256 is put */
#define HCI_WRITE_CURRENT_IAC_LAP_LENGTH                 (256 + HCI_HDR_LEN)

#define HCI_READ_PAGE_SCAN_PERIOD_MODE_LENGTH            (0 + HCI_HDR_LEN)
#define HCI_WRITE_PAGE_SCAN_PERIOD_MODE_LENGTH           (1 + HCI_HDR_LEN)
#define HCI_READ_PAGE_SCAN_MODE_LENGTH                   (0 + HCI_HDR_LEN)
#define HCI_WRITE_PAGE_SCAN_MODE_LENGTH                  (1 + HCI_HDR_LEN)

#ifdef BT_HCI_1_2
#define HCI_SET_AFH_HOST_CHANNEL_CLASSIFICATION_LENGTH   (10 + HCI_HDR_LEN)
#define HCI_READ_INQUIRY_SCAN_TYPE_LENGTH                (0 + HCI_HDR_LEN)
#define HCI_WRITE_INQUIRY_SCAN_TYPE_LENGTH               (1 + HCI_HDR_LEN)
#define HCI_READ_INQUIRY_MODE_LENGTH                     (0 + HCI_HDR_LEN)
#define HCI_WRITE_INQUIRY_MODE_LENGTH                    (1 + HCI_HDR_LEN)
#define HCI_READ_PAGE_SCAN_TYPE_LENGTH                   (0 + HCI_HDR_LEN)
#define HCI_WRITE_PAGE_SCAN_TYPE_LENGTH                  (1 + HCI_HDR_LEN)
#define HCI_READ_AFH_CHANNEL_ASSESSMENT_MODE_LENGTH      (0 + HCI_HDR_LEN)
#define HCI_WRITE_AFH_CHANNEL_ASSESSMENT_MODE_LENGTH     (1 + HCI_HDR_LEN)
#endif /* BT_HCI_1_2 */

#ifdef BT_EIR
#define HCI_READ_EXTENDED_INQUIRY_RESPONSE_LENGTH        (0 + HCI_HDR_LEN)
#define HCI_WRITE_EXTENDED_INQUIRY_RESPONSE_LENGTH       (241 + HCI_HDR_LEN)
#define HCI_READ_INQUIRY_RESP_TX_POWER_LEVEL_LENGTH      (0 + HCI_HDR_LEN)
#define HCI_WRTIE_INQUIRY_RESP_TX_POWER_LEVEL_LENGTH     (1 + HCI_HDR_LEN)
#endif /* BT_EIR */

#ifdef BT_EPR
#define HCI_REFRESH_ENCRYPTION_KEY_LENGTH                (2 + HCI_HDR_LEN)
#endif /* BT_EPR */

#ifdef BT_EDR
#define HCI_READ_DEFAULT_ERR_DATA_REPORTING_LENGTH       (0 + HCI_HDR_LEN)
#define HCI_WRTIE_DEFAULT_ERR_DATA_REPORTING_LENGTH      (1 + HCI_HDR_LEN)
#endif /* BT_EDR */

#ifdef BT_SSP
#define HCI_READ_SIMPLE_PAIRING_MODE_LENGTH              (0 + HCI_HDR_LEN)
#define HCI_WRITE_SIMPLE_PAIRING_MODE_LENGTH             (1 + HCI_HDR_LEN)
#endif /* BT_SSP */

#ifdef BT_SSP_PE
#define HCI_SEND_KEY_PRESS_NOTIFICATION_LENGTH           (7 + HCI_HDR_LEN)
#endif /* BT_SSP_PE */

#ifdef BT_SSP_OOB
#define HCI_READ_LOCAL_OOB_DATA_LENGTH                   (0 + HCI_HDR_LEN)
#endif /* BT_SSP_OOB */

#ifdef BT_ENHANCED_FLUSH
#define HCI_ENHANCED_FLUSH_LENGTH                        (3 + HCI_HDR_LEN)
#endif /* BT_ENHANCED_FLUSH */


#define HCI_READ_LOCAL_VERSION_INFORMATION_LENGTH        (0 + HCI_HDR_LEN)
#define HCI_READ_LOCAL_SUPPORTED_FEATURES_LENGTH         (0 + HCI_HDR_LEN)
#define HCI_READ_BUFFER_SIZE_LENGTH                      (0 + HCI_HDR_LEN)
#define HCI_READ_COUNTRY_CODE_LENGTH                     (0 + HCI_HDR_LEN)
#define HCI_READ_BD_ADDR_LENGTH                          (0 + HCI_HDR_LEN)

#ifdef BT_HCI_1_2
#define HCI_READ_LOCAL_SUPPORTED_COMMANDS_LENGTH         (0 + HCI_HDR_LEN)
#define HCI_READ_LOCAL_EXTENDED_FEATURES_LENGTH          (1 + HCI_HDR_LEN)
#define HCI_READ_LMP_HANDLE_LENGTH                       (2 + HCI_HDR_LEN)
#endif /* BT_HCI_1_2 */


#define HCI_READ_FAILED_CONTACT_COUNTER_LENGTH           (2 + HCI_HDR_LEN)
#define HCI_RESET_FAILED_CONTACT_COUNTER_LENGTH          (2 + HCI_HDR_LEN)
#define HCI_GET_LINK_QUALITY_LENGTH                      (2 + HCI_HDR_LEN)
#define HCI_READ_RSSI_LENGTH                             (2 + HCI_HDR_LEN)

#ifdef BT_HCI_1_2
#define HCI_READ_AFH_CHANNEL_MAP_LENGTH                  (2 + HCI_HDR_LEN)
#define HCI_READ_CLOCK_LENGTH                            (3 + HCI_HDR_LEN)
#endif /* BT_HCI_1_2 */

#ifdef HCI_TESTING_COMMANDS
#define HCI_READ_LOOPBACK_MODE_LENGTH                    (0 + HCI_HDR_LEN)
#define HCI_WRITE_LOOPBACK_MODE_LENGTH                   (1 + HCI_HDR_LEN)
#define HCI_ENABLE_DEVICE_UNDER_TEST_MODE_LENGTH         (0 + HCI_HDR_LEN)
#endif /* HCI_TESTING_COMMANDS */

#ifdef BT_SSP_DEBUG
#define HCI_WRITE_SIMPLE_PAIRING_DEBUG_MODE_LENGTH       (1 + HCI_HDR_LEN)
#endif /* BT_SSP_DEBUG */

#ifdef BT_BRSC_TEST
#define HCI_WRITE_SECURE_CONNECTIONS_TEST_MODE_LENGTH    (3 + HCI_HDR_LEN)
#endif /* BT_BRSC_TEST */

/* Bluetooth 3.0 related command length definitions */
#ifdef BT_3_0

#ifdef HCI_FLOW_CONTROL_COMMANDS
#define HCI_READ_FLOW_CONTROL_MODE_LENGTH                (0 + HCI_HDR_LEN)
#define HCI_WRITE_FLOW_CONTROL_MODE_LENGTH               (1 + HCI_HDR_LEN)
#endif /* HCI_FLOW_CONTROL_COMMANDS */

#define HCI_READ_ENCRYPTION_KEY_SIZE_LENGTH              (2 + HCI_HDR_LEN)
#define HCI_READ_ENHANCED_TRANSMIT_POWER_LEVEL_LENGTH    (3 + HCI_HDR_LEN)
#define HCI_READ_DATA_BLOCK_SIZE_LENGTH                  (0 + HCI_HDR_LEN)
#endif /* BT_3_0 */

#define HCI_WRITE_AUTH_PAYLOAD_TO_LENGTH                 (4 + HCI_HDR_LEN)

#ifdef BT_4_0
#define HCI_LE_SET_EVENT_MASK_LENGTH                       (8 + HCI_HDR_LEN)
#define HCI_LE_READ_BUFFER_SIZE_LENGTH                     (0 + HCI_HDR_LEN)
#define HCI_LE_READ_LOCAL_SUPPORTED_FEATURES_LENGTH        (0 + HCI_HDR_LEN)
#define HCI_LE_SET_RANDOM_ADDRESS_LENGTH                   (6 + HCI_HDR_LEN)
#define HCI_LE_SET_ADVERTISING_PARAMETERS_LENGTH           (15 + HCI_HDR_LEN)
#define HCI_LE_READ_ADVERTISING_CHANNEL_TX_POWER_LENGTH    (0 + HCI_HDR_LEN)
#define HCI_LE_SET_ADVERTISING_DATA_LENGTH                 (32 + HCI_HDR_LEN)
#define HCI_LE_SET_SCAN_RESPONSE_DATA_LENGTH               (32 + HCI_HDR_LEN)
#define HCI_LE_SET_ADVERTISING_ENABLE_LENGTH               (1 + HCI_HDR_LEN)
#define HCI_LE_SET_SCAN_PARAMETERS_LENGTH                  (7 + HCI_HDR_LEN)
#define HCI_LE_SET_SCAN_ENABLE_LENGTH                      (2 + HCI_HDR_LEN)
#define HCI_LE_CREATE_CONNECTION_LENGTH                    (25 + HCI_HDR_LEN)
#define HCI_LE_CREATE_CONNECTION_CANCEL_LENGTH             (0 + HCI_HDR_LEN)
#define HCI_LE_READ_WHITE_LIST_SIZE_LENGTH                 (0 + HCI_HDR_LEN)
#define HCI_LE_CLEAR_WHITE_LIST_LENGTH                     (0 + HCI_HDR_LEN)
#define HCI_LE_ADD_DEVICE_TO_WHITE_LIST_LENGTH             (7 + HCI_HDR_LEN)
#define HCI_LE_REMOVE_DEVICE_FROM_WHITE_LIST_LENGTH        (7 + HCI_HDR_LEN)
#define HCI_LE_CONNECTION_UPDATE_LENGTH                    (14 + HCI_HDR_LEN)
#define HCI_LE_SET_HOST_CHANNEL_CLASSIFICATION_LENGTH      (6 + HCI_HDR_LEN)
#define HCI_LE_READ_CHANNEL_CLASSIFICATION_LENGTH          (2 + HCI_HDR_LEN)
#define HCI_LE_READ_REMOTE_USED_FEATURES_LENGTH            (2 + HCI_HDR_LEN)
#define HCI_LE_ENCRYPT_LENGTH                              (32 + HCI_HDR_LEN)
#define HCI_LE_RAND_LENGTH                                 (0 + HCI_HDR_LEN)
#define HCI_LE_START_ENCRYPTION_LENGTH                     (28 + HCI_HDR_LEN)
#define HCI_LE_LONG_TERM_KEY_REQUESTED_REPLY_LENGTH        (18 + HCI_HDR_LEN)
#define HCI_LE_LONG_TERM_KEY_REQUESTED_NEGATIVE_REPLY_LENGTH \
                                                           (2 + HCI_HDR_LEN)
#define HCI_LE_READ_SUPPORTED_STATES_LENGTH                (0 + HCI_HDR_LEN)

#define HCI_LE_RECEIVER_TEST_COMMAND_LENGTH                (1 + HCI_HDR_LEN)
#define HCI_LE_TRANSMITTER_TEST_COMMAND_LENGTH             (3 + HCI_HDR_LEN)
#define HCI_LE_TEST_END_LENGTH                             (0 + HCI_HDR_LEN)
#endif /* BT_4_0 */

#ifdef BT_4_1
#define HCI_LE_REMOTE_CONN_PARAM_REQ_RPLY_LENGTH              (14 + HCI_HDR_LEN)
#define HCI_LE_REMOTE_CONN_PARAM_REQ_NEG_RPLY_LENGTH          (3 + HCI_HDR_LEN)
#define HCI_TRUNCATED_PAGE_LENGTH                             (9 + HCI_HDR_LEN)
#define HCI_TRUNCATED_PAGE_CANCEL_LENGTH                      (6 + HCI_HDR_LEN)
#define HCI_SET_CONNECTIONLESS_SLAVE_BROADCAST_LENGTH         (11 + HCI_HDR_LEN)
#define HCI_SET_CONNECTIONLESS_SLAVE_BROADCAST_RECEIVE_LENGTH (34 + HCI_HDR_LEN)
#define HCI_START_SYNCHRONIZATION_TRAIN_LENGTH                (0 + HCI_HDR_LEN)
#define HCI_RECEIVE_SYNCHRONIZATION_TRAIN_LENGTH              (12 + HCI_HDR_LEN)
#define HCI_SET_RESERVED_LT_ADDR_LENGTH                       (1 + HCI_HDR_LEN)
#define HCI_DELETE_RESERVED_LT_ADDR_LENGTH                    (1 + HCI_HDR_LEN)
#define HCI_SET_CONNECTIONLESS_SLAVE_BROADCAST_DATA_LENGTH    (255 + HCI_HDR_LEN)
#define HCI_READ_SYNCHRONIZATION_TRAIN_PARAMETERS_LENGTH      (0 + HCI_HDR_LEN)
#define HCI_WRITE_SYNCHRONIZATION_TRAIN_PARAMETERS_LENGTH     (9 + HCI_HDR_LEN)
#define HCI_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY_LENGTH     (70 + HCI_HDR_LEN)
#define HCI_SET_MWS_CHANNEL_PARAMETERS_LENGTH                 (10 + HCI_HDR_LEN)
#define HCI_SET_EXTERNAL_FRAME_CONFIGURATION_LENGTH           (255 + HCI_HDR_LEN)
#define HCI_SET_MWS_SIGNALING_LENGTH                          (30 + HCI_HDR_LEN)
#define HCI_SET_MWS_TRANSPORT_LAYER_LENGTH                    (9 + HCI_HDR_LEN)
#define HCI_SET_MWS_PATTERN_CONFIGURATION_LENGTH              (255 + HCI_HDR_LEN)
#define HCI_SET_MWS_SCAN_FREQUENCY_TABLE_LENGTH               (255 + HCI_HDR_LEN)
#define HCI_READ_EXTENDED_PAGE_TIMEOUT_LENGTH                 (0 + HCI_HDR_LEN)
#define HCI_WRITE_EXTENDED_PAGE_TIMEOUT_LENGTH                (2 + HCI_HDR_LEN)
#define HCI_READ_EXTENDED_INQUIRY_LENGTH_LENGTH               (0 + HCI_HDR_LEN)
#define HCI_WRITE_EXTENDED_INQUIRY_LENGTH_LENGTH              (2 + HCI_HDR_LEN)
#define HCI_READ_LOCAL_OOB_EXTENDED_DATA_LENGTH               (0 + HCI_HDR_LEN)
#define HCI_GET_MWS_TRANSPORT_LAYER_CONFIGURATION_LENGTH      (0 + HCI_HDR_LEN)
#define HCI_SET_TRIGGERED_CLOCK_CAPTURE_LENGTH                (6 + HCI_HDR_LEN)
#endif /* BT_4_1 */

#ifdef HCI_ENH_SCO
#define HCI_SETUP_ENH_SYNCHRONOUS_CONNECTION_LENGTH          (59 + HCI_HDR_LEN)
#define HCI_ACCEPT_ENH_SYNCHRONOUS_CONNECTION_REQUEST_LENGTH (63 + HCI_HDR_LEN)
#endif /* HCI_ENH_SCO */

/* BT 4.2 Specification related Entries */
#ifdef BT_4_2
/* Data Length Extension Feature Related Defines */
#define HCI_LE_SET_DATA_LENGTH_CMD_LENGTH                  (6 + HCI_HDR_LEN)
#define HCI_LE_READ_SUGGESTED_DEFAULT_DATA_LEN_CMD_LENGTH  (0 + HCI_HDR_LEN)
#define HCI_LE_WRITE_SUGGESTED_DEFAULT_DATA_LEN_CMD_LENGTH (4 + HCI_HDR_LEN)

/* Secure Connections Feature Related Defines */
#define HCI_LE_READ_LOCAL_P_256_PUBLIC_KEY_CMD_LENGTH      (0 + HCI_HDR_LEN)
#define HCI_LE_GENERATE_DHKEY_CMD_LENGTH                   (64 + HCI_HDR_LEN)

/* Privacy 1.2 Feature Related Defines */
#define HCI_LE_ADD_DEV_TO_RESOLVING_LIST_LENGTH            (39 + HCI_HDR_LEN)
#define HCI_LE_REMOVE_DEV_FROM_RESOLVING_LIST_LENGTH       (7 + HCI_HDR_LEN)
#define HCI_LE_CLR_RESOLVING_LIST_LENGTH                   (0 + HCI_HDR_LEN)
#define HCI_LE_READ_RESOLVING_LIST_SIZE_LENGTH             (0 + HCI_HDR_LEN)
#define HCI_LE_READ_PEER_RESOLVABLE_ADDR_LENGTH            (7 + HCI_HDR_LEN)
#define HCI_LE_READ_LOCAL_RESOLVABLE_ADDR_LENGTH           (7 + HCI_HDR_LEN)
#define HCI_LE_SET_ADDR_RESOLUTION_ENABLE_LENGTH           (1 + HCI_HDR_LEN)
#define HCI_LE_SET_RESOLVABLE_PRIVATE_ADDR_TIMEOUT_LENGTH  (2 + HCI_HDR_LEN)
#endif /* BT_4_2 */

#ifdef BT_5_0
/* BT 5.0 Specification related Entries */
/* LE 2Mbps PHY related */
#define HCI_LE_READ_PHY_CMD_LENGTH                         (2 + HCI_HDR_LEN)
#define HCI_LE_SET_DEFAULT_PHY_CMD_LENGTH                  (3 + HCI_HDR_LEN)
#define HCI_LE_SET_PHY_CMD_LENGTH                          (7 + HCI_HDR_LEN)
#define HCI_LE_ENHANCED_RECEIVER_TEST_CMD_LENGTH           (3 + HCI_HDR_LEN)
#define HCI_LE_ENHANCED_TRANSMITTER_TEST_CMD_LENGTH        (4 + HCI_HDR_LEN)

/* LE Advertising Extension Related */
#define HCI_LE_SET_EXTENDED_ADV_PARAMS_CMD_LENGTH          (25 + HCI_HDR_LEN)
#define HCI_LE_SET_PERIODIC_ADV_PARAMS_CMD_LENGTH          (7 + HCI_HDR_LEN)
#define HCI_LE_SET_EXTENDED_SCAN_RESPONSE_DATA_CMD_LENGTH  (4 + HCI_HDR_LEN)
#define HCI_LE_SET_EXTENDED_ADVERTISE_ENABLE_CMD_LENGTH    (2 + HCI_HDR_LEN)
#define HCI_LE_READ_MAX_ADV_DATA_LENGTH_CMD_LENGTH         (1 + HCI_HDR_LEN)
#define HCI_LE_READ_NUM_SUPPORTED_ADV_SETS_CMD_LENGTH      (0 + HCI_HDR_LEN)
#define HCI_LE_READ_ADVERTISING_TRANSMIT_POWER_CMD_LENGTH  (0 + HCI_HDR_LEN)
#define HCI_LE_REMOVE_ADVERTISING_SET_CMD_LENGTH           (1 + HCI_HDR_LEN)
#define HCI_LE_CLEAR_ADVERTISING_SETS_CMD_LENGTH           (0 + HCI_HDR_LEN)
#define HCI_LE_SET_EXTENDED_SCAN_PARAMETERS_CMD_LENGTH     (13 + HCI_HDR_LEN)
#define HCI_LE_SET_EXTENDED_SCAN_ENABLE_CMD_LENGTH         (6 + HCI_HDR_LEN)
#define HCI_LE_PERIODIC_ADV_CREATE_SYNC_CMD_LENGTH         (14 + HCI_HDR_LEN)
#define HCI_LE_ADD_DEV_TO_PERIODIC_ADVSER_LIST_CMD_LENGTH  (8 + HCI_HDR_LEN)
#define HCI_LE_RM_DEV_FRM_PERIODIC_ADVSER_LIST_CMD_LENGTH  (8 + HCI_HDR_LEN)
#define HCI_LE_CLEAR_PERIODIC_ADVSER_LIST_CMD_LENGTH       (0 + HCI_HDR_LEN)
#define HCI_LE_READ_PERIODIC_ADVSER_LIST_SIZE_CMD_LENGTH   (0 + HCI_HDR_LEN)
#define HCI_LE_SET_SCAN_REQUEST_NTF_ENABLE_CMD_LENGTH      (2 + HCI_HDR_LEN)
#define HCI_LE_READ_RF_PATH_COMPENSATION_CMD_LENGTH        (0 + HCI_HDR_LEN)
#define HCI_LE_WRITE_RF_PATH_COMPENSATION_CMD_LENGTH       (4 + HCI_HDR_LEN)
#define HCI_LE_SET_ADVERTISING_SET_RANDOM_ADDRESS_CMD_LENGTH (7 + HCI_HDR_LEN)
#define HCI_LE_SET_PERIODIC_ADVERTISING_DATA_CMD_LENGTH    (3 + HCI_HDR_LEN)
#define HCI_LE_SET_PERIODIC_ADVERTISING_ENABLE_CMD_LENGTH  (2 + HCI_HDR_LEN)
#define HCI_LE_PERIODIC_ADV_CREATE_CANCEL_SYNC_CMD_LENGTH  (0 + HCI_HDR_LEN)
#define HCI_LE_PERIODIC_ADV_TERMINATE_SYNC_CMD_LENGTH      (2 + HCI_HDR_LEN)
#define HCI_LE_EXTENDED_CREATE_CONNECTION_CMD_LENGTH       (58 + HCI_HDR_LEN)
#define HCI_LE_SET_PRIVACY_MODE_CMD_LENGTH                 (8 + HCI_HDR_LEN)
#endif /* BT_5_0 */

#ifdef BT_5_1
/* BT 5_1 Specification related Entries */
#define HCI_LE_RECEIVER_TEST_V3_LENGTH                                  (255 + HCI_HDR_LEN)
#define HCI_LE_TRANSMITTER_TEST_V3_LENGTH                               (255 + HCI_HDR_LEN)
#define HCI_LE_SET_CONNECTIONLESS_CTE_TRANSMIT_PARAMETERS_LENGTH        (255 + HCI_HDR_LEN)
#define HCI_LE_SET_CONNECTIONLESS_CTE_TRANSMIT_ENABLE_LENGTH            (2 + HCI_HDR_LEN)
#define HCI_LE_SET_CONNECTIONLESS_IQ_SAMPLING_ENABLE_LENGTH             (255 + HCI_HDR_LEN)
#define HCI_LE_SET_CONNECTION_CTE_RECEIVE_PARAMETERS_LENGTH             (255 + HCI_HDR_LEN)
#define HCI_LE_SET_CONNECTION_CTE_TRANSMIT_PARAMETERS_LENGTH            (255 + HCI_HDR_LEN)
#define HCI_LE_SET_CONNECTION_CTE_REQUEST_ENABLE_LENGTH                 (7 + HCI_HDR_LEN)
#define HCI_LE_SET_CONNECTION_CTE_RESPONSE_ENABLE_LENGTH                (3 + HCI_HDR_LEN)
#define HCI_LE_READ_ANTENNA_INFORMATION_LENGTH                          (0 + HCI_HDR_LEN)
#define HCI_LE_SET_PERIODIC_ADVERTISING_RECEIVE_ENABLE_LENGTH           (3 + HCI_HDR_LEN)
#define HCI_LE_PERIODIC_ADVERTISING_SYNC_TRANSFER_LENGTH                (6 + HCI_HDR_LEN)
#define HCI_LE_PERIODIC_ADVERTISING_SET_INFO_TRANSFER_LENGTH            (5 + HCI_HDR_LEN)
#define HCI_LE_SET_PERIODIC_ADVERTISING_SYNC_TRANSFER_PARAMETERS_LENGTH (8 + HCI_HDR_LEN)
#define HCI_LE_SET_DEFAULT_PERIODIC_ADVERTISING_SYNC_TRANSFER_PARAMETERS_LENGTH (6 + HCI_HDR_LEN)
#define HCI_LE_GENERATE_DHKEY_V2_LENGTH                                 (65 + HCI_HDR_LEN)
#define HCI_LE_MODIFY_SLEEP_CLOCK_ACCURACY_LENGTH                       (1 + HCI_HDR_LEN)
#define HCI_READ_LOCAL_SIMPLE_PAIRING_OPTIONS_LENGTH                    (0 + HCI_HDR_LEN)
#endif /* BT_5_1 */

#ifdef BT_5_2
/* BT 5_2 Specification related Entries */
#define HCI_LE_READ_ISO_TX_SYNC_LENGTH                                  (2 + HCI_HDR_LEN)
#define HCI_LE_SET_CIG_PARAMETERS_LENGTH                                (255 + HCI_HDR_LEN)
#define HCI_LE_SET_CIG_PARAMETERS_TEST_LENGTH                           (255 + HCI_HDR_LEN)
#define HCI_LE_CREATE_CIS_LENGTH                                        (255 + HCI_HDR_LEN)
#define HCI_LE_REMOVE_CIG_LENGTH                                        (1 + HCI_HDR_LEN)
#define HCI_LE_ACCEPT_CIS_REQUEST_LENGTH                                (2 + HCI_HDR_LEN)
#define HCI_LE_REJECT_CIS_REQUEST_LENGTH                                (3 + HCI_HDR_LEN)
#define HCI_LE_CREATE_BIG_LENGTH                                        (31 + HCI_HDR_LEN)
#define HCI_LE_CREATE_BIG_TEST_LENGTH                                   (36 + HCI_HDR_LEN)
#define HCI_LE_TERMINATE_BIG_LENGTH                                     (2 + HCI_HDR_LEN)
#define HCI_LE_BIG_CREATE_SYNC_LENGTH                                   (255 + HCI_HDR_LEN)
#define HCI_LE_BIG_TERMINATE_SYNC_LENGTH                                (1 + HCI_HDR_LEN)
#define HCI_LE_REQUEST_PEER_SCA_LENGTH                                  (2 + HCI_HDR_LEN)
#define HCI_LE_SETUP_ISO_DATA_PATH_LENGTH                               (255 + HCI_HDR_LEN)
#define HCI_LE_REMOVE_ISO_DATA_PATH_LENGTH                              (3 + HCI_HDR_LEN)
#define HCI_LE_ISO_TRANSMIT_TEST_LENGTH                                 (3 + HCI_HDR_LEN)
#define HCI_LE_ISO_RECEIVE_TEST_LENGTH                                  (3 + HCI_HDR_LEN)
#define HCI_LE_ISO_READ_TEST_COUNTERS_LENGTH                            (2 + HCI_HDR_LEN)
#define HCI_LE_ISO_TEST_END_LENGTH                                      (2 + HCI_HDR_LEN)
#define HCI_LE_SET_HOST_FEATURE_LENGTH                                  (2 + HCI_HDR_LEN)
#define HCI_LE_READ_ISO_LINK_QUALITY_LENGTH                             (2 + HCI_HDR_LEN)
#define HCI_LE_ENHANCED_READ_TRANSMIT_POWER_LEVEL_LENGTH                (3 + HCI_HDR_LEN)
#define HCI_LE_READ_REMOTE_TRANSMIT_POWER_LEVEL_LENGTH                  (3 + HCI_HDR_LEN)
#define HCI_LE_SET_PATH_LOSS_REPORTING_PARAMETERS_LENGTH                (8 + HCI_HDR_LEN)
#define HCI_LE_SET_PATH_LOSS_REPORTING_ENABLE_LENGTH                    (3 + HCI_HDR_LEN)
#define HCI_LE_SET_TRANSMIT_POWER_REPORTING_ENABLE_LENGTH               (4 + HCI_HDR_LEN)
#define HCI_SET_ECOSYSTEM_BASE_INTERVAL_LENGTH                          (2 + HCI_HDR_LEN)
#define HCI_CONFIGURE_DATA_PATH_LENGTH                                  (255 + HCI_HDR_LEN)
#define HCI_READ_LOCAL_SUPPORTED_CODECS_V2_LENGTH                       (0 + HCI_HDR_LEN)
#define HCI_READ_LOCAL_SUPPORTED_CODEC_CAPABILITIES_LENGTH              (7 + HCI_HDR_LEN)
#define HCI_READ_LOCAL_SUPPORTED_CONTROLLER_DELAY_LENGTH                (255 + HCI_HDR_LEN)
#endif /* BT_5_2 */

/* Variable length, Max = 256 */
#define HCI_VENDOR_SPECIFIC_COMMAND_LENGTH                 (256 + HCI_HDR_LEN)

/* HCI Parameter Range Defines - selective */
#define HCI_LE_TX_TIME_START_RANGE                         0x0148

#ifdef BT_5_0
#define HCI_LE_TX_TIME_END_RANGE                           0x4290
#else
#define HCI_LE_TX_TIME_END_RANGE                           0x0848
#endif /* BT_5_0 */

#endif /* _H_HCI_DEFINES_ */

